package com.xdxc.model.entity;


import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.xdxc.emuns.QuestionType;
import com.xdxc.utils.CustomDeserializer;
import com.xdxc.utils.CustomSerializer;
import com.xdxc.utils.JsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 实体类对应数据库中的表 user_answer
 */
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName(value = "user_answer", autoResultMap = true)
@Data

public class UserAnswer implements Serializable {

    @TableId(type = IdType.ASSIGN_ID) // MyBatis-Plus 雪花算法
    private Long id;

    private Long paperId;

    private Long quId;

    private QuestionType answerType;

    @TableField(typeHandler = JsonTypeHandler.class)
    private List<Long> answerIds; // JSON 类型字段，存储选项 ID 集合

    private String answerText; // 文本答案
    @TableField(typeHandler = JsonTypeHandler.class)
    private List<String> answerFiles; // 文件路径集合

    private Integer version; // 版本号（乐观锁）

    private Boolean isDeleted; // 逻辑删除标记

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private String answerTypeText;

    private Long userId;
    private  Long examId;
    private  Long checkId;


}
